<template>
	<view class="apps">
		<uv-alert title="提示：只显示最近的5条充值订单" type="error"></uv-alert>
		<view class="flex fdc ptb10 plr20" v-if="list.length > 0">
			<view class="flex fdc  bgwhite mb20" v-for="(item,index) in list" :key="index">
				<view class="flex aic jcsa bdb1d bceee plr10 ptb20">
					<view class="flex f1 red f26 ">订单号:{{item.out_trade_no}}</view>
					<view class="flex f22">
						{{ formatTime(item.create_time) }}
					</view>
				</view>
				<view class="flex fdc bdb1d bceee plr10 ptb20">
					<view class="flex aic jcsa">
						<view class="flex f1 c666 f22 ">交易信息</view>
						<view class="flex f22 c333">
							{{item.title}}
						</view>
					</view>
					<view class="flex aic jcsa">
						<view class="flex f1 c666 f22 ">订单金额</view>
						<view class="flex f22 c333">
							{{item.price}}
						</view>
					</view>
					<view class="flex aic jcsa">
						<view class="flex f1 c666 f22 ">支付方式</view>
						<view class="flex f22 c333">
							<text v-if="item.type =='wechat'">微信支付</text>
							<text v-if="item.type =='gift'">券码赠送</text>
						</view>
					</view>
					<view class="flex aic jcsa">
						<view class="flex f1 c666 f22 ">支付状态</view>
						<view class="flex f22 c333">
							<text v-if="item.pay_status =='0'" style="color:#f56c6c">未支付</text>
							<text v-if="item.pay_status =='1'">已支付</text>
							<text v-if="item.pay_status =='2'" style="color:#3c9cff">无需支付</text>
						</view>
					</view>
				</view>
				<view class="flex fdc bdb1d bceee plr10 ptb20" v-if="item.type =='wechat'">
					<view class="flex aic jcsa">
						<view class="flex f1 c666 f26 fweight4">支付信息</view>
						<view class="flex f22 c333">
							
						</view>
					</view>
					<view class="flex aic jcsa">
						<view class="flex f1 c666 f22 ">支付金额</view>
						<view class="flex f22 c333">
							{{item.pay_total}}
						</view>
					</view>
					<view class="flex aic jcsa">
						<view class="flex f1 c666 f22 ">微信交易号</view>
						<view class="flex f22 c333">
							{{item.transaction_id}}
						</view>
					</view>
					
				</view>
			</view>
		</view>
		<view v-else>
			<uv-empty icon="empty-page"></uv-empty>
		</view>
	</view>
</template>

<script>
	import { util } from '/common/util.js';
	import { timeFormat } from '@/uni_modules/uv-ui-tools/libs/function/index.js';
	let app;
	export default {
		data() {
			return {
				list:[]
			}
		},
		onLoad() {
			app = this;
			this.getList();
		},
		methods: {
			formatTime(e){
				return timeFormat(e*1000,'yyyy-mm-dd hh:MM');
			},
			getList(){
				const page = this.page;
				util.request({
					url:'/mpuser/order',
				}).then((res)=>{
					if(res.code == 1){
						app.list = res.data;
					}
				})
			}
		}
	}
</script>

<style scoped>
	.c666{color:#666;}
	.c333{color:#333;}
</style>
